#ifndef _PCA9557_H_
#define _PCA9557_H_
#include "i2c2.h"

#define PCA9557_ADDR1 0x18
#define PCA9557_ADDR2 0x1c

#define DIG1_ON(val) (val&(1<<5))
#define DIG2_ON(val) (val&(1<<2))
#define DIG3_AND_D1_D2_ON(val) (val&(1<<1))
#define DIG4_ON (val&(1<<8))

#define A_ON(val) (val|(1<<4))


/* 控制寄存器 （CMD）*/
#define PCA9557_CONTROL_REG_0 0x00	// Input Port Register           (R)    BXXXXXXXX (Default)
#define PCA9557_CONTROL_REG_1 0x01	// Output Port Register          (R/W)  B00000000
#define PCA9557_CONTROL_REG_2 0x02	// Polarity Inversion Register   (R/W)  B11110000
#define PCA9557_CONTROL_REG_3 0x03	// Configuration Register        (R/W)  B11111111

class PCA9557:protected i2c2
{
private:
    /* data */
public:
    void pca9557_init();
    void pca9557_setval(unsigned char oneval,unsigned char twoval);

    PCA9557(/* args */);
    ~PCA9557();
};




#endif